import React, { Component, Fragment } from 'react';
import { Form, Input, Radio, Upload, Button, message, Descriptions, Result } from 'antd'
import { UploadOutlined } from '@ant-design/icons';
import { connect } from 'dva';
import QualificationExaminationPage from '../components/processPage/qualificationExaminationPage'
import ValidationReviewPage from '../components/processPage/validationReviewPage'
import SignVerificationAgreementPage from '../components/processPage/signVerificationAgreementPage'
import TestDataPage from '../components/processPage/testDataPage'
import VerificationPage from '../components/processPage/verificationPage'
import VerificationExaminationPage from '../components/processPage/verificationExaminationPage'
import FinishedPage from '../components/processPage/finishedPage'

class VeritificationProcess extends Component {
    constructor(props) {
        super(props)
    }

    render() {
        if (this.props.user.userType != 1) {
            return (
                <Result
                    status="warning"
                    title="请先登录技术供应商账号后再查看技术验证！"
                >
                </Result>
            )
        }

        if (this.props.verification.phase == 1 && this.props.verification.examination == -1) {
            return (
                <QualificationExaminationPage></QualificationExaminationPage>
            )
        }
        if(this.props.verification.phase == 2 || (this.props.verification.phase == 1 && this.props.verification.examination != -1)){
            return(
                <ValidationReviewPage></ValidationReviewPage>
            )
        }

        if(this.props.verification.phase == 3){
            return(
                <SignVerificationAgreementPage></SignVerificationAgreementPage>
            )
        }

        if(this.props.verification.phase == 4){
            return(
                <TestDataPage></TestDataPage>
            )
        }

        if(this.props.verification.phase == 5){
            return(
                <VerificationPage></VerificationPage>
            )
        }

        if(this.props.verification.phase == 6){
            return(
                <VerificationExaminationPage></VerificationExaminationPage>
            )
        }

        if(this.props.verification.phase == 7){
            return(
                <FinishedPage></FinishedPage>
            )
        }
    }
}

const mapStateToProps = state => {
    let user = state.app.user
    let verification = state.application.verification
    return {
        user,
        verification
    }
}

export default connect(mapStateToProps)(VeritificationProcess)